import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiInquiryFeedbackStatus from "@/pages/v1/erp/InquiryFeedbackStatus/js/apiInquiryFeedbackStatus";
import apiSeller from "@/pages/v1/erp/Seller/js/apiSeller";
import apiPayType from "@/pages/v1/erp/PayType/js/apiPayType";
import apiEmp from "@/pages/v1/erp/Emp/js/apiEmp";
import apiTaxType from "@/pages/v1/erp/TaxType/js/apiTaxType";
import apiDeliverType from "@/pages/v1/erp/DeliverType/js/apiDeliverType";
import apiPayCashType from "@/pages/v1/erp/PayCashType/js/apiPayCashType";
/*
fb.addText("sn","单据编号",3)
fb.addText("title","单据主题",3)
fb.addText("seller","供应商",3)
fb.addText("sellerName","供应商名称",3)
fb.addText("taxType","发票类型",3)
fb.addText("payType","付款方式",3)
fb.addText("payCashType","结算方式",3)
fb.addText("deliverType","交货方式",3)
fb.addText("deliverAt","交货时间",3)
fb.addText("deliver","交货地点",3)
fb.addText("contactEmp","业务员",3)
fb.addText("contact","联系人",3)
fb.addText("contactPhone","联系电话",3)
fb.addText("status","状态",3)
fb.addText("isCancel","是否取消",3)
fb.addText("isClose","是否关闭",3)
fb.addText("isConfirm","是否生效",3)
fb.addText("confirmAt","生效时间",3)
fb.addText("formAt","制单时间",3)
fb.addText("formEmp","制单人",3)
fb.addText("createEmp","创建人",3)
fb.addText("note","备注",3)
fb.addText("product","产品",3)

* */
export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addText("sn","单据编号",3)
        fb.addText("title","单据主题",6)
            .setRules([fb.R.notNull("单据编号不能为空")])
        fb.addCascade("statusId","状态",3)
            .setApi(apiInquiryFeedbackStatus.urlTree)
            .setRules([fb.R.notNull("请设置状态")])

        fb.addSearch("sellerId","供应商",3)
            .setApi(apiSeller.urlChoice).setApiSearchKeys(["name__regex"])
        fb.addText("sellerName","供应商名称",3)
        fb.addSelect("payTypeId","付款方式",3)
            .setApi(apiPayType.urlChoice)
        fb.addSelect("payCashTypeId","结算方式",3)
            .setApi(apiPayCashType.urlChoice)
        fb.addText("deliver","交货地点",3)
        fb.addSelect("taxTypeId","发票类型",3)
            .setApi(apiTaxType.urlChoice)
        fb.addSelect("deliverTypeId","交货方式",3)
            .setApi(apiDeliverType.urlChoice)

        fb.addSearch("formEmpId","制单人",3).setApi(apiEmp.urlChoice).setApiSearchKeys(["name__regex","phone__regex"])
        fb.addDateTime("formAt","制单时间",3).setDateTypeDate()
        fb.addText("contact","联系人",3)
        fb.addText("contactPhone","联系电话",3)

        fb.addSearch("contactEmpId","业务员",3)
            .setApi(apiEmp.urlChoice).setApiSearchKeys(["name__regex","phone__regex"])


        fb.addText("num","数量",3).setTextTypeNumber()
        fb.addText("money","金额",3).setTextTypeNumber()

        fb.addText("note","备注",12)
            .setTextMulti(true)
            .setTextRows(3)
        return fb
    },
    tree:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addCascade("parentId").setLabel("上级分类").setSpan(3)
            .setApi(api.urlTree)

        fb.addText("name").setSpan(6).setLabel("分类名称")
            .setRules([fb.R.notNull("名称不能为空")])

        fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()
        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}